package com.tedu.bill;

/**
 * Author：毕龙
 * Date: 2024/3/24 9:11
 */
public class TestWhile {
    public static void main(String[] args) {
        //打印10次hello world
        //代码冗余
        /*System.out.println("hello world");
        System.out.println("hello world");
        System.out.println("hello world");
        System.out.println("hello world");
        System.out.println("hello world");
        System.out.println("hello world");
        System.out.println("hello world");
        System.out.println("hello world");
        System.out.println("hello world");
        System.out.println("hello world");*/

        //声明循环初始的变量
        int i = 0;
        //循环条件
        while ( i < 10 ){
            //逻辑代码
            System.out.println("hello world  " + (i+1));
            //初始变量迭代
            i ++;//i = i+1;
        }


        /**
         * 1-100之间的和
         */
        int j = 1;
        //声明一个求和的变量
        int total = 0;
        while (j <= 100){
            total += j;//total = total+j;
            j++;
        }
        System.out.println(total);
    }
}
